#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    int count = 0;
    for(size_t i = 0; i <= n; i++)
    {
        int perfect_number = 0;

        for(size_t j = 1; j <= sqrt(i); j++)
        {
            if(i % j == 0)
            {
                perfect_number += j;
                if(i / j == i)
                    perfect_number += j;
            }
        }
        if(perfect_number == i)
            count++;
    }

    cout << count << endl;

    return 0;
}